<template>
    <div class="container-full">
        <div v-if="$store.state.shop.selectMode == 'scan'" class="predict-price-order-num">
            <p>订单号：{{ $store.state.shop.order }}</p>
        </div>
        <div class="confirm-predict-price-list">
            <!-- <price-item v-for="(item, index) in dataset"
                :title="item.title" :price="item.price.toFixed(2)" :weight="item.weight" :number="item.number" :key="index" class="list-item"
            /> -->
            <price-item v-for="(item, index) in dataset"
                :title="item.title" :price="parseFloat(item.price).toFixed(2)" :unit="item.unit" :number="item.number" :key="index" class="list-item"
            />
        </div>
        <bottom-submit-confirm />
    </div>
</template>

<style lang="scss" scoped>
    .predict-price-order-num {
        background-color: #00CC00;
        color: #ffffff;
        padding: 1rem;
        font-size: 1.4rem;
    }

    .confirm-predict-price-list {
        margin-top: 1rem;

        .list-item {
            padding: 1rem 1.6rem;
            border-bottom: 0.5rem solid #EEEEEE;

            &:last-child {
                border-bottom: none;
            }
        }
    }
</style>

<script>
    import PriceItem from '../../components/currency/order-list/order-price.vue';
    import BottomSubmitConfirm from '../../components/currency/order-item/bottom-submit-confirm.vue';

    export default {
        name: 'ShopPredictPrice',
        components: {
            BottomSubmitConfirm, PriceItem
        },
        data() {
            return {
                dataset: []
            }
        },
        mounted() {
            for(let index of this.$store.state.shop.selectItems) {
                this.dataset.push(this.$store.state.shop.carts[index]);
            }
        }
    }
</script>
